<extend name="Public/common" />
<block name="body">
<script type="text/javascript" src="__JS__/jquery-ui/jquery.ui.js"></script>
<script type="text/javascript" src="__JS__/jquery-ui/i18n/zh-CN.js" charset="utf-8"></script>
<link rel="stylesheet" type="text/css" href="__JS__/jquery-ui/themes/ui-lightness/jquery.ui.css"  />
<div class="page">
  <div class="fixed-bar">
    <div class="item-title">
      <h3>菜谱管理</h3>
      <ul class="tab-base">
        	<li><a href="{:U('index')}"><span>列表</span></a></li>
	        <li><a href="{:U('add')}"><span>新增</span></a></li>
	        <li><a href="JavaScript:void(0);" class="current"><span>编辑</span></a></li>
      </ul>
    </div>
  </div>
  <div class="fixed-empty"></div>
  <form id="form1" method="post" enctype="multipart/form-data" name="form1">
    <input type="hidden" name="menu_id" value="{$info['menu_id']}" />
    <table class="table tb-type2">
      <tbody>
        <tr class="noborder">
          <td colspan="2" class="required"><label class="validation" for="area_id">区域选择:</label></td>
        </tr>
        <tr class="noborder">
          <td class="vatop rowform"><select class='class-select' name="area_id" id="area_id">
              <option value="">区域名称</option>
		      <notempty name="area">
		      <volist name="area" id="vo">
              <option <eq name="info.area_id" value="$key">selected='selected'</eq> value="{$key}">{$vo}</option>
              </volist>
              </notempty>
            </select></td>
          <td class="vatop tips">区域名称 必须选择</td>
        </tr>

        <tr class="noborder">
          <td colspan="2" class="required"><label>出售截止时间: </label></td>
        </tr>
        <tr class="noborder">
          <td class="vatop rowform" style="width:400px;"><input type="text" name="menu_date" id="menu_date" class="txt date" style="width:100px;" value="{:@date('Y-m-d', $info['menu_date'])}"/>日
          </td>
          <td class="vatop tips"></td>
        </tr>
      </tbody>
      <tfoot>
        <tr class="tfoot">
          <td colspan="15" ><a href="JavaScript:void(0);" class="btn" id="submit"><span>提交</span></a></td>
        </tr>
      </tfoot>
    </table>
  </form>
</div>

<script type="text/javascript">
$(document).ready(function(){
	$('#menu_date').datepicker({dateFormat: 'yy-mm-dd'});
	$('#form1').validate({
        errorPlacement: function(error, element){
			error.appendTo(element.parent().parent().prev().find('td:first'));
        },
        rules : {
        	area_id : {
                required : true
            },
            menu_date : {
                required : true,
                date  : true 
            }
        },
        messages : {
        	area_id : {
                required : "请选择区域"
            },
            menu_date : {
                required : "请填写菜单日期",
                date : "时间必须是年月日格式"
            }
        }
    });

	$("#submit").click(function() {
		if ($("#form1").valid()) {
			$("#form1").submit();
		}
	});
});
</script>
</block>